package org.jplcc.memory;

import java.util.Arrays;
import java.util.Collection;

import org.jplcc.Connection;
import org.jplcc.JPLCCException;
import org.jplcc.PLCMetadata;
import org.jplcc.Type;

public class MemoryPLCMetadata implements PLCMetadata {

	private MemoryConnection connection;

	MemoryPLCMetadata(MemoryConnection connection) {
		this.connection = connection;
	}

	@Override
	public Connection getConnection() throws JPLCCException {
		return connection;
	}

	@Override
	public int getDriverMajorVersion() {
		return 0;
	}

	@Override
	public int getDriverMinorVersion() {
		return 1;
	}

	@Override
	public String getDriverName() throws JPLCCException {
		return "In Memory PLC Driver";
	}

	@Override
	public String getDriverVersion() throws JPLCCException {
		return String.valueOf(getDriverMajorVersion()) + "."
		+ String.valueOf(getDriverMinorVersion());
	}

	@Override
	public String getPLCProductName() throws JPLCCException {
		return "MemoryPLC";
	}

	@Override
	public Collection<Type> getSupportedTypes() throws JPLCCException {
		return Arrays.asList(Type.values());
	}

}
